<!-- 引用头部文件 -->
<?php require VIEW_PATH."/header.php";?>
<!-- 头部文件end -->
<body>
<!-- 引用第三方静态文件 -->
<link rel="stylesheet" href="Public/org/kindeditor/themes/default/default.css" />
<script src="Public/org/kindeditor/kindeditor.js"></script>
<script src="Public/org/kindeditor/lang/zh_CN.js"></script>
<link rel="stylesheet" href="{{__VIEW__}}/Goods/css.css" />
<script type="text/javascript">
	var goods_id = "{{$field['goods_id']}}";
</script>
<script src="{{__VIEW__}}/Goods/js.js"></script>
<!-- 静态end -->

<!-- 添加页的表单 -->
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="goods_id" value="{{$field['goods_id']}}">
	<!-- 内容div -->
	<div class="hd-tab">
		<!-- 顶部面板切换div -->
		<ul class="hd-tab-menu">
		    <li lab="base" class="active"><a>商品設置</a></li>
		    <li lab="goods_pic"><a>商品圖集</a></li>
		    <li lab="goods_value"><a>商品屬性</a></li>
		    <li lab="goods_detail"><a>商品詳情</a></li>
		</ul>
		<!-- 切换end -->

		<!-- 需要切换的内容框 -->
		<div class="hd-tab-content">
			<!-- 基础设置面板 -->
			<div lab="base" class="hd-tab-area">
				<table class="hd-table hd-table-form hd-form">
					<!-- 標題部位 -->
					<thead>
		                <tr>
		                    <td colspan="2">添加商品</td>
		                </tr>
                	</thead>
                	<!-- 標題end -->
                	<tbody>
                		<tr>
                			<th>商品所屬欄目</th>
                			<td>
                				<select name="cat_id">
                				<option value="">·····请选择欄目·····</option>
                				<?php foreach($catData as $cat):?>
                					<option value="{{$cat['cat_id']}}" 
                						<?php if($cat['cat_id']==$field['cat_id']):?>
                						selected="" disabled=""
                						<?php endif;?>
                					>{{$cat['_name']}}</option>                					
                				<?php endforeach;?>
                				</select>
                			</td>
                		</tr>
                		<tr>
                			<th>商品的名稱</th>
                			<td>
                				<input type="text" name="goods_name" value="{{$field['goods_name']}}">
                			</td>
                		</tr>
                		<tr>
                			<th>商品的貨號</th>
                			<td>
                				<input type="text" name="goods_sn" value="{{$field['goods_sn']}}">
                			</td>
                		</tr>
                		<tr>
                			<th>單位</th>
                			<td>
                				<input type="text" name="unit" value="{{$field['unit']}}">
                			</td>
                		</tr>
                		<tr>
                			<th>商品所屬品牌</th>
                			<td>
                				<select name="brand_id">
                				<option value="">·····请选择品牌·····</option>
                				<?php foreach($brandData as $brand):?>
                					<option value="{{$brand['id']}}"
                						<?php if($brand['id']==$field['brand_id']):?>
                							selected="" disabled=""
                						<?php endif;?>
                					>{{$brand['name']}}</option>
                				<?php endforeach;?>
                				</select>
                			</td>
                		</tr>
                		<tr>
                			<th>點擊數</th>
                			<td>
                				<input type="text" name="click" value="{{$field['click']}}">
                			</td>
                		</tr>
                		<tr>
                			<th>列表頁圖</th>
                			<td>
                				<img class="listPic" src="{{$field['list_pic']}}">
                				<p class="lp">
                					<input type="file" name="list_pic">
                				</p>
                				
                			</td>
                		</tr>
                		<tr>
                			<th>縮略圖</th>
                			<td>
                				<img class="thumbPic" src="{{$field['thumb_pic']}}">
                				<p class="tp">
                					<input type="file" name="thumb_pic">
                				</p>
                				
                			</td>
                		</tr>
                		<tr>
                			<th>市場價</th>
                			<td>
                				<input type="text" name="shop_price" value="{{$field['shop_price']}}">
                			</td>
                		</tr>
                		<tr>
                			<th>現價</th>
                			<td>
                				<input type="text" name="price" value="{{$field['price']}}">
                			</td>
                		</tr>
                		<tr>
                			<th>商品關鍵字</th>
                			<td>
                				<input type="text" name="keyword" value="{{$field['keyword']}}">
                			</td>
                		</tr>
                		<tr>
                			<th>商品的描述</th>
                			<td>
                				<textarea name="description">{{$field['description']}}</textarea>
                			</td>
                		</tr>
                	</tbody>
				</table>
			</div>
			<!-- 基础设置end -->

			<!-- 商品图集 -->
			<div lab="goods_pic" class="hd-tab-area">
				<ul class="picList">
					<?php foreach($pics as $pic):?>
					<li class="picLi" id="picLi{{$pic['id']}}">
						<img src="{{$pic['small_pic']}}" style="width:100px;margin-left:0px;">
						<section id="liDel">
							<span onclick="delPic({{$pic['id']}})" class="btn btn-info">
								x
							</span>
						</section>
					</li>
				<?php endforeach;?>
				</ul>
				<table>
					<tr>
						<td class="pic-td"	>
							<input type="file" name="pics[]" style="display:inline-block">
							<button type="button" class="btn btn-warning" onclick="addPic(this)">＋</button>
						</td>
					</tr>
				</table>
			</div>
			<!-- 商品图集end -->

			<!-- 商品属性 -->
			<div lab="goods_value" class="hd-tab-area">
				<table class="hd-table hd-table-form hd-form">
					<thead>
						<tr>
							<td colspan="2">商品属性设置</td>
						</tr>
					</thead>
					<tbody>
						<tr>
							<th class="th-title">商品类型</th>
							<td>
								<select name="type_id" onchange="getEditListTpl()">				
									<option value="">===请选择商品的类型===</option>
									<?php foreach($shopType as $shop):?>
									<option value="{{$shop['id']}}"
									<?php if($shop['id']==$field['type_id']):?>
										selected=""
									<?php endif;?>
									>{{$shop['type_name']}}</option>
								    <?php endforeach;?>								  	
								</select>
								<!-- 温馨提示 -->
			                    <span style="font-weight: bold;">
			                        <label style="color:red;">*</label>
			                     &nbsp;温馨提示，请选择类型后，根据需要填写商品属性
			                    </span>
			                    <!-- 温馨提示end --> 
							</td>
						</tr>
						<!-- 具体模版显示 -->
						<tr>
							<td colspan="2" style="padding:0;margin: 0;">
		                    <p class="link" style=""></p>
		                    <!-- 内容插入表单 -->
		                    <table id="attr_list" class="hd-table hd-table-form hd-form">
		                         
		                    </table>
                    		<!-- 内容插入表单end -->
                			</td>
						</tr>
						<!-- 具体模版显示end -->
					</tbody>

				</table>
			</div>
			<!-- 商品属性end -->

			<!-- 商品详情 -->
			<div lab="goods_detail" class="hd-tab-area">
				<table class="hd-table hd-table-form hd-form">
					<thead>
		                <tr>
		                    <td colspan="2">商品详情</td>
		                </tr>
		            </thead>
						<tr>
							<th>商品详情</th>
							<td>
								<textarea name="content" id="content" style="width:800px;height:400px;visibility:hidden;"></textarea>
							</td>
						</tr>
						<tr>
							<th>售后服务</th>
							<td>
								<textarea name="service" id="service" style="width:800px;height:400px;visibility:hidden;"></textarea>
							</td>
						</tr>
				</table>
			</div>
			<!-- 商品详情end -->
		</div>
		<!-- 内容框end -->
	</div>
	<!-- 内容div end -->
	<div>
		<button type="submit" class="hd-btn">保存修改</button>
	</div>
</form>
<!-- 表单end -->
</body>
<!-- 点进编辑页面就判断该商品的值 -->
<script type="text/javascript">
	var type_id = $('[name=type_id]').find('option:selected').val();	
  	getEditListTpl(type_id);
</script>
<!-- 点进编辑页面就判断该商品的值end -->
</html>